# _*_ coding: utf-8 _*_
__author__ = 'yinlei'
__date__ = '2018-05-19 13:32'

from .views import cms_route
import config
from flask import session,g
from .models import CMSUser,CMSPermission

@cms_route.before_request
def before_request():
    if config.CMS_USER_ID in session:
        user_id = session.get(config.CMS_USER_ID)
        user = CMSUser.query.get(user_id)
        if user:
            g.cms_user = user

@cms_route.context_processor
def cms_context_processor():
    return {'CMSPermission':CMSPermission}

